package com.lang8.util;

import java.io.File;

public class PathUtil {
	public static File getWebInfFile(){
		File file = new File(PathUtil.class.getResource("/").getFile());
		while (true) {
			if (file == null) {
				throw new NullPointerException("File is null while looking for WEB-INF.");
			}
			if (file.getName().equalsIgnoreCase("WEB-INF")) {
				return file;
			}
			file = file.getParentFile();
		}
	}
	public static String getWebInfPath(){
		return getWebInfFile().getAbsolutePath();
	}
	public static File getWebRootFile(){
		return getWebInfFile().getParentFile();
	}
	public static String getWebRootPath(){
		return getWebRootFile().getAbsolutePath();
	}
}
